<?php

namespace app\admin\model;

use think\Model;


class Staffmodel extends Model
{
  protected $table = 'gjc_staff';
  function getChatLog()
  {
    /* 
    SELECT content ,sender_id ,rec_id,time
FROM gjc_chat  
WHERE  rec_id ='-9999' or sender_id ='-9999'
    */
    $menList = db('chat')
    ->alias('c')

    ->field(' c.sender_id as uid , u.`nickname`,u.head')
    ->join('gjc_user u','u.uid = c.sender_id')
    ->where("c.rec_id ='-9999'")
    ->group('c.sender_id')
    ->select();

    $logList =db('chat')
    ->field('content ,sender_id ,rec_id,time')
    ->where("rec_id ='-9999' or sender_id ='-9999'")
    ->select();
    return [$menList,$logList];
  }
}
